package com.kaibo.demo.controller;

import com.kaibo.demo.http.HttpApi;
import okhttp3.ResponseBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: kaibo
 * @date: 2021/1/13 18:49
 * @GitHub: https://github.com/yuxuelian
 * @qq: 568966289
 * @description:
 */

@RestController
@RequestMapping("/")
public class AutoConfigTestController {

    @Autowired
    HttpApi httpApi;

    @GetMapping("test")
    public String test() {
        try {
            ResponseBody responseBody = httpApi.testRequest().execute().body();
            if (responseBody != null) {
                return responseBody.string();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "失败";
    }


    @GetMapping("aaa")
    public String aaa() {
        return "aaaaa-aaaaa";
    }

}
